﻿using DevExpress.Xpf.Charts;
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace TeBigCommonUI.Converter
{
    public class PieThicknessConverter : IMultiValueConverter
    {
        // Token: 0x06002AC3 RID: 10947 RVA: 0x0007BAA4 File Offset: 0x00079CA4
        public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
        {
            if (targetType == typeof(Thickness) && value[0] is SeriesPointPresentationData sppd)
            {
                var bounds = sppd.Layout.Bounds;

                PieSeries.SetExplodedDistance(sppd.SeriesPoint, 0.03);

                var cnt = sppd.SeriesPoint.Series.Points.Count;
                var idx = sppd.SeriesPoint.Series.Points.IndexOf(sppd.SeriesPoint);

                return new Thickness((cnt - idx) * (bounds.Width * 0.01)/*5*/);

                //return new Thickness(MyRandom.NextInt(0, 5) * (bounds.Width * 0.01)/*5*/);
            }

            return null;
        }

        // Token: 0x06002AC4 RID: 10948 RVA: 0x0007BB28 File Offset: 0x00079D28
        public object[] ConvertBack(object value, Type[] targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}